(function(){"use strict";BX.namespace("BX.Landing.UI.Tool");var t=BX.Landing.Utils.createRangeFromNode;var e=BX.Landing.Utils.isNumber;var i=BX.Landing.Utils.rect;BX.Landing.UI.Tool.autoFontScaleEntry=function(t){this.element=t;this.minSize=8;this.maxSize=parseInt(BX.style(t,"font-size"));this.maxLetterSpacing=parseFloat(BX.style(t,"letter-spacing"));this.maxLetterSpacing=e(this.maxLetterSpacing)?this.maxLetterSpacing:0;this.minLetterSpacing=0;this.paddings=30;this.changed=false};BX.Landing.UI.Tool.autoFontScaleEntry.prototype={setFontSize:function(t){t=Math.min(Math.max(t,this.minSize),this.maxSize);this.element.style.setProperty("font-size",t+"px","important")},setLetterSpacing:function(t){t=Math.min(Math.max(t,this.minLetterSpacing),this.maxLetterSpacing);this.element.style.setProperty("letterSpacing",t+"px")},resetSize:function(){this.element.style.setProperty("fontSize",null);this.element.style.setProperty("letterSpacing",null);this.element.style.setProperty("display",null)},adjust:function(){if(this.changed||this.getRangeWidth()>this.getParentWidth()){this.changed=true;var t=this.getParentWidth()*this.getFontSizeRatio();var e=this.getParentWidth()*this.getLetterSpacingRatio();this.setFontSize(t-e);this.setLetterSpacing(e)}if(!this.changed&&this.maxSize>40&&BX.width(window)<=600){this.setFontSize(this.getParentWidth()*this.getBaseFontSizeRatio())}},getCurrentSize:function(){return parseInt(BX.style(this.element,"font-size"))},getFontSizeRatio:function(){if(e(this.ratio)){return this.ratio}this.ratio=this.maxSize/this.getRangeWidth();return this.ratio},getLetterSpacingRatio:function(){if(e(this.letterSpacingRatio)){return this.letterSpacingRatio}this.letterSpacingRatio=this.maxLetterSpacing/this.getRangeWidth();return this.letterSpacingRatio},getBaseFontSizeRatio:function(){if(e(this.baseFontSizeRatio)){return this.baseFontSizeRatio}this.baseFontSizeRatio=this.getCurrentSize()/(600-this.paddings);return this.baseFontSizeRatio},getRangeWidth:function(){return i(t(this.element)).width},getParentWidth:function(){return Math.min(i(this.element).width,BX.width(window)-this.paddings)}}})();
//# sourceMappingURL=auto-font-scale-entry.map.js